/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
 * Description: Hmfs-tools encoding
 */

#ifndef HMFS_ENCODING_H
#define HMFS_ENCODING_H

#include <functional>
#include <memory>
#include <string>

#include "hmfs_log.h"

namespace OHOS {
namespace Hmfs {
struct EncodingInfo {
    std::string encodingName;
    uint16_t encodingKey;
    uint16_t initialFlags;
};

std::string Utf16ToUtf8(const std::u16string &utf16Str);
std::u16string Utf8ToUtf16(const std::string &utf8Str);
bool IsNeedEncoding(int32_t encoding);
int32_t CaseFold(const unsigned char *str, size_t len, unsigned char *dest, size_t destLen);

int32_t EncodingStrToValue(std::string &encodingString, uint16_t &value);
int32_t EncodingValueToStr(const uint16_t encodingVal, std::string &str);
uint16_t GetDefaultEncodingFlag(uint16_t encoding);
int32_t EncodingFlagStrToValue(std::string &flagsStr, uint16_t &flags);

} // namespace Hmfs
} // namespace OHOS
#endif // HMFS_ENCODING_H